#!/bin/bash

# 设置keyFile权限 - 必须在mongod启动前完成
chmod 600 /etc/mongodb-keyfile
chown 999:999 /etc/mongodb-keyfile

# 验证权限设置
ls -la /etc/mongodb-keyfile

# 启动MongoDB
exec mongod --replSet rs0 --bind_ip_all --keyFile /etc/mongodb-keyfile 